/*
 * @Author: sxb
 * @Email: sxb@mail.com
 * @Date: 2020-03-16 14:33:21
 * @Descripttion: 
 */
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';

import { Observable } from "rxjs"

@Injectable({
  providedIn: 'root'
})
export class BoxingManageService {
  //装箱：任务单管理
  private taskInfoUrl = "/api/taskinfo";  
  getTaskInfo(data): Observable<any> {
    return this.http.get(this.taskInfoUrl, {params: { ...data }});
  }  
  //装箱：装箱单明细管理
  private boxingDetailUrl = "/api/boxingDetail";
  getBoxingDetail(data): Observable<any> {
    return this.http.get(this.boxingDetailUrl, {params: { ...data }});
  }
  /**
   * @Author: sxb
   * @Email: sxb@mail.com
   * @Date: 2020-04-01 15:27:43
   * @UseComponent: 
   * @Descripttion: 修改装箱单明细
   * @Return: 
   */
  putBoxingDetail(data): Observable<any> {
    return this.http.put(this.boxingDetailUrl, data);
  }
  /**
   * @Author: sxb
   * @Email: sxb@mail.com
   * @Date: 2020-04-01 15:28:01
   * @UseComponent: 
   * @Descripttion: 删除装箱单明细
   * @Return: 
   */
  delBoxingDetail(data): Observable<any> {
    let _dataJson = {
        headers: new HttpHeaders({
            'Content-Type': 'application/json',
        }),
        body: data
    }
    return this.http.delete(this.boxingDetailUrl, _dataJson);
  }
  getBoxingDetailsNoDeal(data): Observable<any> {
    return this.http.get("/api/boxingDetail/getBoxingDetailsNoDeal", {params: { ...data }});
  }
  putConfirmdetail(data): Observable<any> {
    return this.http.put("/api/boxingDetail/confirmdetail", data);
  }
  //装箱：装箱单桶明细管理
  private boxingBucketDetailUrl = "/api/boxingBucketDetail";
  getBoxingBucketDetail(data): Observable<any> {
    return this.http.get(this.boxingBucketDetailUrl, {params: { ...data }});
  }
  /**
   * @Author: sxb
   * @Email: sxb@mail.com
   * @Date: 2020-04-01 15:27:43
   * @UseComponent: 
   * @Descripttion: 修改装箱单桶明细
   * @Return: 
   */
  putBoxingBucketDetail(data): Observable<any> {
    return this.http.put(this.boxingBucketDetailUrl, data);
  }
  /**
   * @Author: sxb
   * @Email: sxb@mail.com
   * @Date: 2020-04-01 15:28:01
   * @UseComponent: 
   * @Descripttion: 删除装箱单桶明细
   * @Return: 
   */
  delBoxingBucketDetail(data): Observable<any> {
    let _dataJson = {
        headers: new HttpHeaders({
            'Content-Type': 'application/json',
        }),
        body: data
    }
    return this.http.delete(this.boxingBucketDetailUrl, _dataJson);
  }
  postBoxingBucketDetailCreate(data): Observable<any> {
    return this.http.post("/api/boxingBucketDetail/createlist", data).pipe();
  }

  //装箱：装箱单管理
  postCreateList(data): Observable<any> {
    return this.http.post("/api/boxing/createlist", data).pipe()
  }
  /**
   * @Author: sxb
   * @Email: sxb@mail.com
   * @Date: 2020-04-01 15:35:55
   * @UseComponent: 
   * @Descripttion: 删除装箱单
   * @Return: 
   */
  delCreateList(data): Observable<any> {
    return this.http.delete("/api/boxing/delete?id="+data, {});
  }

  constructor(
    private http:HttpClient
    ) { }
}
